/*************************************************************************
> File Name: general.h
> Author: icebear
> Mail: 3322366195@qq.com
> Created Time: 2023-07-20 19:35:19
> Description: 常用库——>例如数组的输出，获取数组长度,交换两数
************************************************************************/
#ifndef GENERAL_H
#define GENERAL_H
#include <stdio.h>
int printArr(int *arr, int length)
{
    printf("The array is: ");
    for (int i = 0; i < length; i++)
    {
        printf("%d,", *(arr + i));
    }
    printf("\b \n");
}
void swap(int *a, int *b)
{
    if (a != b)
    {
        *a = *a ^ *b;
        *b = *a ^ *b;
        *a = *a ^ *b;
    }
}

int getArrMax(int arr[], int length)
{
    int max = arr[0];
    for (int i = 0; i < length; i++)
    {
        if (max < arr[i])
        {
            max = arr[i];
        }
    }
    return max;
}
int getArrMin(int arr[], int length)
{
    int min = arr[0];
    for (int i = 0; i < length; i++)
    {
        if (min > arr[i])
        {
            min = arr[i];
        }
    }
    return min;
}

#endif